#include "BallTest.h"

BallTest::BallTest()
{
}

void BallTest::initGameObjectWith(GamePlayScreen *_gameScreen, CCDictionary *_dict)
{
    GameObject::initGameObjectWith(_gameScreen, _dict);

    this->createSprite();
    this->createPhysicBody();
}

void BallTest::createSprite()
{
    sprite = new CCSprite();
    sprite->initWithSpriteFrameName("stone_0.png");
    sprite->setPosition(CCPointMake(70 * ScreenManager::sharedScreenMan()->scaleFactor, 450 * ScreenManager::sharedScreenMan()->scaleFactor));
    sprite->setTag(LAND);
}

void BallTest::createPhysicBody()
{
    b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;

    bodyDef.userData = this;
    if (sprite) {
        bodyDef.position.Set(sprite->getPositionX() / PTM_RATIO, sprite->getPositionY() / PTM_RATIO);
    }
    physicBody = handler->world->CreateBody(&bodyDef);

    DataAccess::sharedDataAccess()->getFixturesForBody(physicBody, "stone_0", 0);
}
